import React, { Component, Fragment } from "react";
import { inject, observer } from "mobx-react";
import { withRouter, Link } from 'react-router-dom';
import { tools, WingBlank, Button } from 'weaver-mobile';
import { Browser, DocumentTitle } from 'weaver-mobile-page';
const { getLabel } = tools;

@inject('docExchangeStore')
@withRouter
@observer
class sendOtherBrowser extends Component {
  constructor(props) {
    super(props);
    this.state = {}
  }
  componentWillUnmount() {
    const { docExchangeStore } = this.props;
    docExchangeStore.initCheckData();
  }
  render() {
    const { docExchangeStore, historyProp } = this.props;
    const { sendOtherBrowser, sendOtherUnits } = docExchangeStore;
    const datas = [
      { match: /^\/docExchange\/sendToOther/i, title: () => getLabel('', "发送其他单位") },
    ];
    return (<Fragment>
      <DocumentTitle data={datas} defaultTitle="" />
      <Browser
        store={sendOtherBrowser}
        title={getLabel(388098, "发送其他单位")}
        hasAdvanceSerach={true}
        isSingle={false}
        type={142}
        showCheckStrictly= {true}
        tabs={[
          {
            dataParams: { cmd: "List" },
            isSearch: true,
            key: "1",
            name: "列表",
            selected: false,
            showOrder: 0
          },
          {
            dataParams: { cmd: "Organization" },
            isSearch: false,
            key: "2",
            name: "组织结构",
            selected: false,
            showOrder: 0
          },
          {
            dataParams: { cmd: "PublicGroup" },
            isSearch: false,
            key: "3",
            name: "公共组",
            selected: false,
            showOrder: 0
          },
          {
            dataParams: { cmd: "PrivateGroup" },
            isSearch: false,
            key: "4",
            name: "私人组",
            selected: false,
            showOrder: 0
          },
          {
            dataParams: { cmd: "ExternalUnit", companyType: 1 },
            isSearch: false,
            key: "5",
            name: "外部单位",
            selected: false,
            showOrder: 0
          }
        ]}
        onChange={(unitIds) => sendOtherUnits(unitIds, historyProp)}
      >
        <span />
      </Browser>
    </Fragment>);
  }
}

export default sendOtherBrowser;